package com.wyx.suanfa;

/**
 * @author 王艺锡
 * @version 1.0
 */
public class test1 {
    public static void main(String[] args) {
        String str1 = "hello";
        String str2 = "llo";

        if(str2.length() == 0){
            System.out.println(-1);;
        }

        int len1 = str1.length();
        int len2 = str2.length();
        int count = 0;
        char[] arr1 = str1.toCharArray();
        char[] arr2 = str2.toCharArray();

        for(int i = 0;i < len1 - len2 + 1;i++){
            int m = i;
            int n = 0;
            count = 0;
            while (n < len2 && arr1[m] == arr2[n]){
                m++;
                n++;
                count++;
            }
            if(n == len2){
                System.out.println(count);
            }
        }
        System.out.println(-1);
    }
}
